<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('meeting/room/index')}">展位管理</a></li>
        <li class="active"><a href="{:url('meeting/order/detail',['room_id'=>$info['room_id']])}">申请发票</a></li>
    </ul>
    <form method="post" action="{:url('saveBill')}" class="js-ajax-form">

    <if condition="$bill">
        <div class="form-group">
            <label for="">展位</label>
            <input type="text" class="col-xs-9 form-control" readonly name="number" value="{$bill.number}">
        </div>
        <div class="form-group">
            <label for="">公司</label>
            <input type="text" class="col-xs-9 form-control" readonly name="company_name" value="{$bill.company_name}">
        </div>
        <div class="form-group">
            <label for="">税号</label>
            <input type="text" class="col-xs-9 form-control" readonly name="credit_code" value="{$bill.credit_code}">
        </div>
        <div class="form-group">
            <label for="">账号</label>
            <input type="number" class="col-xs-9 form-control" readonly name="bank_no" value="{$bill.bank_no}">
        </div>
        <div class="form-group">
            <label for="">方式</label>
            <input type="radio" name="type" onclick="changeType2(1)" id="type_1" value="1">电子
            <input type="radio" name="type" onclick="changeType2(0)" id="type_0" value="0">纸质
        </div>
        <div class="form-group" id="email_1" style="display: none">
            <label for="">邮箱</label>
            <input type="text" class="col-xs-9 form-control" name="email" value="{$bill.email}">
        </div>
        <div class="form-group" id="address_0" style="display: none">
            <label for="">收件地址</label>
            <input type="text" class="col-xs-9 form-control" name="address" value="{$bill.address}">
            <span style="color: red">快递到付，邮费自理</span>
        </div>
        <div class="form-group">
            <label for="">明细</label>
            <table class="table table-bordered">
                <tr>
                    <th>项目</th>
                    <th>价格</th>
                    <th>数量</th>
                    <th>总价</th>
                </tr>
                <foreach name="data" item="vo">
                    <tr>
                        <td>{$vo.name}</td>
                        <td>{$vo.val}</td>
                        <td>{$vo.number}</td>
                        <td>{$vo.total}</td>
                    </tr>
                </foreach>
                <tr>
                    <th colspan="3">合计</th>
                    <th>{$total}</th>
                </tr>


            </table>
        </div>
        <if condition="$bill['status'] eq 2">
            <div class="form-group">
                <label for="">拒绝理由：</label>
                {$bill.reason}
            </div>
            <div class="form-group">
                <input type="hidden" name="price" value="{$bill.price}">
                <input type="hidden" name="builder_id" value="{$info.builder_id}">
                <input type="hidden" name="room_id" value="{$bill.room_id}">
                <input type="hidden" name="meeting_id" value="{$bill.meeting_id}">
                <input type="submit" class="btn btn-primary js-ajax-submit" value="申请">
            </div>
        </if>
        <else/>
            <div class="form-group">
                <label for="">展位</label>
                <input type="text" class="col-xs-9 form-control" readonly name="number" value="{$info.number}">
            </div>
            <div class="form-group">
                <label for="">公司</label>
                <input type="text" class="col-xs-9 form-control" name="company_name" value="{$builder_info.company}">
            </div>
            <div class="form-group">
                <label for="">税号</label>
                <input type="text" class="col-xs-9 form-control" name="credit_code" value="{$builder_info.credit_code}">
            </div>
            <div class="form-group">
                <label for="">账号</label>
                <input type="number" class="col-xs-9 form-control" name="bank_no" value="{$builder_info.bank_no}">
            </div>
            <div class="form-group">
                <label for="">方式</label>
                <input type="radio" name="type" onclick="changeType(1)" value="1">电子
                <input type="radio" name="type" onclick="changeType(0)" value="0">纸质
            </div>
            <div class="form-group" id="email" style="display: none">
                <label for="">邮箱</label>
                <input type="text" class="col-xs-9 form-control" name="email" value="{$builder_info.email}">
            </div>
            <div class="form-group" id="address" style="display: none">
                <label for="">收件地址</label>
                <input type="text" class="col-xs-9 form-control" name="address" value="{$builder_info.address}">
                <span style="color: red">快递到付，邮费自理</span>
            </div>
            <div class="form-group">
                <label for="">明细</label>
                <table class="table table-bordered">
                    <tr>
                        <th>项目</th>
                        <th>价格</th>
                        <th>数量</th>
                        <th>总价</th>
                    </tr>
                    <foreach name="data" item="vo">
                        <tr>
                            <td>{$vo.name}</td>
                            <td>{$vo.val}</td>
                            <td>{$vo.number}</td>
                            <td>{$vo.total}</td>
                        </tr>
                    </foreach>
                    <tr>
                        <th colspan="3">合计</th>
                        <th>{$total}</th>
                    </tr>


                </table>
            </div>
            <if condition="empty($bill)">
                <div class="form-group">
                    <input type="hidden" name="price" value="{$total}">
                    <input type="hidden" name="builder_id" value="{$info.builder_id}">
                    <input type="hidden" name="room_id" value="{$info.room_id}">
                    <input type="hidden" name="meeting_id" value="{$info.meeting_id}">
                    <input type="submit" class="btn btn-primary js-ajax-submit" value="申请">
                </div>
            </if>


    </if>

    </form>

</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $(function () {
        var id = "{$bill.id}"
        if (id) {
            var type = "{$bill.type}"
            if (type) {
                $('#type_' + type).attr({checked: 'checked'})
                if (type) {
                    $('#email_1').css({display: ''})
                    $('#address_0').css({display: 'none'})
                } else {
                    $('#email_1').css({display: 'none'})
                    $('#address_0').css({display: ''})
                }
            }
        }
    })

    function changeType(val) {
        if (val) {
            $('#email').css({display: ''})
            $('#address').css({display: 'none'})
        } else {
            $('#email').css({display: 'none'})
            $('#address').css({display: ''})
        }
    }
    function changeType2(val) {
        if (val) {
            $('#email_1').css({display: ''})
            $('#address_0').css({display: 'none'})
        } else {
            $('#email_1').css({display: 'none'})
            $('#address_0').css({display: ''})
        }
    }
</script>
</body>
</html>